
const { createWebAPIRequest } = require('../../util/util')

module.exports =
module.exports = [
  {
    /**
    * @api {get} /music/simi/playlist [simi ,相似歌单]
    * @apiGroup Music
    * @apiPermission none
    * @apiParam {Number} id  id
    */
    url: '/music/simi/playlist',
    method: 'get',
    request: (req, res) => {
      const cookie = req.get('Cookie') ? req.get('Cookie') : ''
      const data = {
        songid: req.query.id
      }
      createWebAPIRequest(
        'music.163.com',
        '/weapi/discovery/simiPlaylist',
        'POST',
        data,
        cookie,
        musicReq => {
          res.send(musicReq)
        },
        err => res.status(500).send({err})
      )
    }
  }, {
    /**
    * @api {get} /music/simi/song [simi ,相似歌曲]
    * @apiGroup Music
    * @apiPermission none
    * @apiParam {Number} id  id
    */
    url: '/music/simi/song',
    method: 'get',
    request: (req, res) => {
      const cookie = req.get('Cookie') ? req.get('Cookie') : ''
      const data = {
        songid: req.query.id
      }
      createWebAPIRequest(
        'music.163.com',
        '/weapi/v1/discovery/simiSong',
        'POST',
        data,
        cookie,
        musicReq => {
          res.send(musicReq)
        },
        err => res.status(500).send({err})
      )
    }
  }, {
    /**
    * @api {get} /music/simi/mv [相似 mv]
    * @apiGroup Music
    * @apiPermission none
    * @apiParam {Number} mvid  mvid
    */
    url: '/music/simi/mv',
    method: 'get',
    request: (req, res) => {
      const cookie = req.get('Cookie') ? req.get('Cookie') : ''
      const data = {
        mvid: req.query.mvid
      }
      createWebAPIRequest(
        'music.163.com',
        '/weapi/discovery/simiMV',
        'POST',
        data,
        cookie,
        musicReq => res.send(musicReq),
        err => res.status(500).send({err})
      )
    }
  }, {
    /**
    * @api {get} /music/simi/user [simi ,相似关注的用户]
    * @apiGroup Music
    * @apiPermission none
    * @apiParam {Number} id  id
    */
    url: '/music/simi/user',
    method: 'get',
    request: (req, res) => {
      const cookie = req.get('Cookie') ? req.get('Cookie') : ''
      const data = {
        songid: req.query.id
      }
      createWebAPIRequest(
        'music.163.com',
        '/weapi/discovery/simiUser',
        'POST',
        data,
        cookie,
        musicReq => {
          res.send(musicReq)
        },
        err => res.status(500).send({err})
      )
    }
  }, {
    /**
    * @api {get} /music/simi/artist [相似歌手]
    * @apiGroup Music
    * @apiPermission none
    * @apiParam {Number} id  id
    */
    url: '/music/simi/artist',
    method: 'get',
    request: (req, res) => {
      const cookie = req.get('Cookie') ? req.get('Cookie') : ''
      const id = req.query.id
      const data = {
        artistid: id,
        csrf_token: ''
      }
      createWebAPIRequest(
        'music.163.com',
        `/weapi/discovery/simiArtist`,
        'POST',
        data,
        cookie,
        musicReq => res.send(musicReq),
        err => res.status(500).send({err})
      )
    }
  }
]
